Check "mac" address sooner in device_create function, before doing device_add.
authorIan Jackson <Ian.Jackson@eu.citrix.com>
Tue, 22 Jun 2010 15:07:00 +0000 (16:07 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Tue, 22 Jun 2010 15:07:00 +0000 (16:07 +0100)
commitc1acfe560ba36ee1df3cb92253e507b4369f9585
treebda62b4953d391a87994330588a14924c94e1e4b
parentb9ae83b6e2a50a21a6fe16273218e3403d053fc7
Check "mac" address sooner in device_create function, before doing device_add.

In XendDomainInfo.py device_create function, when device type is
"vif", it has a paragraph to check the validity of "mac"
address. Before checking validity, device_add has been done. But after
checking validity, if the mac address is invlid, it raises VmError and
exits directly without doing clean work like removing the device item
from config info. This will cause that the incorrect mac address is
saved into VM Config file and VM fails to restart. If check "mac"
validity before doing device_add, there will be no problem.

Signed-off-by Chunyan Liu <CYLiu@novell.com>
tools/python/xen/xend/XendDomainInfo.py